<template>
    <FormItem :label="`${itemData.label}：`"
              :prop="itemData.name"
              :label-for="itemData.name"
              :rules='itemData.rules'>
        <div class="qw-form-txt"
             v-if="!!itemData.readonly">{{ formData[itemData.name] }}</div>
        <Select v-else
                v-model="formData[itemData.name]"
                @on-change="handleChange"
                :disabled="itemData.disabled"
                :filterable='itemData.filterable'
                :multiple='itemData.multiple'>
            <Option v-for="item in itemData.selectList"
                    :value="item.value"
                    :key="item.value">{{ item.label }}</Option>
        </Select>
    </FormItem>
</template>
<script>
    export default {
        props: {
            itemData: {
                type: Object
            },
            formData: {
                type: Object
            }
        },
        data () {
            return {
                dataList: []
            };
        },
        methods: {
            // 改变选中值
            handleChange (value, type) {
                this.$emit('handleChangeFormData', this.formData);
            }
        }
    }
</script>
